package com.openbravo.data.loader;

import com.openbravo.basic.BasicException;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.List;

public class SerializerWriteComposed
  implements SerializerWrite
{
  private List<SerializerWrite> serwrites = new ArrayList();

  public void add(SerializerWrite paramSerializerWrite)
  {
    this.serwrites.add(paramSerializerWrite);
  }

  public void writeValues(DataWrite paramDataWrite, Object paramObject)
    throws BasicException
  {
    Object[] arrayOfObject = (Object[])(Object[])paramObject;
    DataWriteComposed localDataWriteComposed = new DataWriteComposed(paramDataWrite);
    int i = 0;
    Iterator localIterator = this.serwrites.iterator();
    while (localIterator.hasNext())
    {
      SerializerWrite localSerializerWrite = (SerializerWrite)localIterator.next();
      localDataWriteComposed.next();
      localSerializerWrite.writeValues(localDataWriteComposed, arrayOfObject[(i++)]);
    }
  }

  private static class DataWriteComposed
    implements DataWrite
  {
    private DataWrite dp;
    private int offset = 0;
    private int max = 0;

    public DataWriteComposed(DataWrite paramDataWrite)
    {
      this.dp = paramDataWrite;
    }

    public void next()
    {
      this.offset = this.max;
    }

    public void setInt(int paramInt, Integer paramInteger)
      throws BasicException
    {
      this.dp.setInt(this.offset + paramInt, paramInteger);
      this.max = Math.max(this.max, this.offset + paramInt);
    }

    public void setString(int paramInt, String paramString)
      throws BasicException
    {
      this.dp.setString(this.offset + paramInt, paramString);
      this.max = Math.max(this.max, this.offset + paramInt);
    }

    public void setDouble(int paramInt, Double paramDouble)
      throws BasicException
    {
      this.dp.setDouble(this.offset + paramInt, paramDouble);
      this.max = Math.max(this.max, this.offset + paramInt);
    }

    public void setBoolean(int paramInt, Boolean paramBoolean)
      throws BasicException
    {
      this.dp.setBoolean(this.offset + paramInt, paramBoolean);
      this.max = Math.max(this.max, this.offset + paramInt);
    }

    public void setTimestamp(int paramInt, Date paramDate)
      throws BasicException
    {
      this.dp.setTimestamp(this.offset + paramInt, paramDate);
      this.max = Math.max(this.max, this.offset + paramInt);
    }

    public void setBytes(int paramInt, byte[] paramArrayOfByte)
      throws BasicException
    {
      this.dp.setBytes(this.offset + paramInt, paramArrayOfByte);
      this.max = Math.max(this.max, this.offset + paramInt);
    }

    public void setObject(int paramInt, Object paramObject)
      throws BasicException
    {
      this.dp.setObject(this.offset + paramInt, paramObject);
      this.max = Math.max(this.max, this.offset + paramInt);
    }
  }
}

/* Location:           D:\PowerFulPOS-2.30.2\openbravopos.jar
 * Qualified Name:     com.openbravo.data.loader.SerializerWriteComposed
 * JD-Core Version:    0.6.0
 */